﻿/*
 * Copyright(C) 2012,ajayumi 保留所有权利。( All rights reserved. )
 * 
 * 文件名称：ProviderFactory.cs
 * 摘    要：
 * 当前版本：1.0
 * 作    者：黄乙冬 (ajayumi)
 * 创建日期：2012年6月9日星期六
 */
using System;
using System.Configuration.Provider;

namespace ajayumi.Platform.Core.Security
{
    /// <summary>
    /// ProviderFactory
    /// </summary>
    public sealed class ProviderFactory
    {
        private readonly static SecurityManagerSection m_config = SecurityConfig.Config;

        public static CryptoProvider CreateCryptoProvider()
        {
            if (!m_config.Crypto.Enabled)
            {
                throw new ProviderException("Crypto provider is not enabled.");
            }
            Type t = Type.GetType(m_config.Crypto.ProviderType);
            return (CryptoProvider)System.Activator.CreateInstance(t);
        }


    }
}
